﻿@inherits TestComponentBase

<Fixture Tests="new Action[]{ InitialHtmlIsCorrect, AfterBtnClickCounterIsIncremented }">
    <ComponentUnderTest><Counter /></ComponentUnderTest>
    <Fragment>
        <h1>Counter</h1>
        <p>Current count: 0</p>
        <button class="btn btn-primary">Click me</button>
    </Fragment>
</Fixture>
@code {
    void InitialHtmlIsCorrect()
    {
        // act
        var cut = GetComponentUnderTest<Counter>();

        // assert
        cut.MarkupMatches(GetFragment());
    }

    void AfterBtnClickCounterIsIncremented()
    {
        // arrange
        var cut = GetComponentUnderTest<Counter>();

        // act
        cut.Find("button").Click(); // first click
        cut.Find("button").Click(); // 2nd click
        cut.Find("button").Click(); // 3rd click

        // assert
        cut.GetChangesSinceFirstRender().ShouldHaveSingleTextChange("Current count: 3");
    }
}

